"""
django-denorm
"""

from fields import MirrorField, AggregateField

def monkeypatch():
    """
    Makes the denorm fields appear in django.db.models.
    """
    
    import django.db.models
    django.db.models.MirrorField = MirrorField
    django.db.models.AggregateField = AggregateField


# Try loading django settings, and see if we should auto-monkeypatch
try:
    from django.conf import settings
except ImportError:
    pass
else:
    try:
        if settings.DENORM_MONKEYPATCH:
            monkeypatch()
    except AttributeError:
        pass